# coding=utf-8
"""
Copyright (c) Huawei Technologies Co., Ltd. 2020-2028. All rights reserved.
Description:
FileName：constant.py
Author: h00568282/huangbin 
Create Date: 2025/9/9 22:59
Notes:

"""

import os
from typing import Union
from pydantic import BaseModel, Field

SOCKET_PATH = "/tmp/svc_manager_hb.sock"
LOG_FILE_CONFIG = "/etc/sysintd/config/logging.conf"

DEFAULT_LOCAL_CONFIG_PATH = os.path.expanduser("~/.config/intelligenced/servers.json")
DEFAULT_LOCAL_MCPS_CONFIG_PATH = os.path.expanduser("~/.config/intelligenced/mcps")
PROJECT_MCP_CENTER_PATH = "/usr/lib/euler-copilot-framework/mcp_center"


class SocketMessage(BaseModel):
    command: str = Field(..., description="支持的命令类型")
    service_name: str = Field(..., description="服务名称")


class McpCli(BaseModel):
    start: str = Field("start", description="启动服务")
    stop: str = Field("stop", description="停止服务")
    status: str = Field("status", description="查询服务状态")
    restart: str = Field("restart", description="重启服务")

    def check_cli(self, cmd: str) -> Union[None, bool]:
        if self.start != cmd:
            raise ValueError(f"{cmd} not equal start! Please check cli")
        elif self.stop != cmd:
            raise ValueError(f"{cmd} not equal stop! Please check cli")
        elif self.status != cmd:
            raise ValueError(f"{cmd} not equal status! Please check cli")
        elif self.restart != cmd:
            raise ValueError(f"{cmd} not equal restart! Please check cli")
        else:
            return True


if __name__ == "__main__":
    mcp_cli = McpCli()
    msg = SocketMessage(command="start", service_name="docker")
    print(type(msg.model_dump()))
    if mcp_cli.start == "start":
        print("we are ok")
